cd "/Users/gaborsimonovits/Dropbox/populism/jop/final_replication_material/lapop_raw"


** 19

use lapop_19_raw.dta, clear
recode usvb1011 (77 4003=0) (4001=-1) (4002=1), gen(pid)
gen year=2019
keep  jc15a jc16a pid year
save lapop19.dta, replace


** 17


use lapop_17_raw.dta
recode usvb1011 (77 4003=0) (4001=-1) (4002=1), gen(pid)
gen year=2017
keep jc10 jc13 jc15a pid year
save lapop17.dta, replace

** 14

use  lapop_14_raw.dta
recode usvb1011 (77 4003=0) (4001=-1) (4002=1), gen(pid)
gen year=2014
keep jc10 jc13 jc15a pid year
save lapop14.dta, replace

*06

use  lapop_06_raw.dta
recode VB11 (2=-1) (3 4 .=0), gen(pid)
gen year=2006
renvars JC15 JC16 / jc15a jc16a
keep  jc15a jc16a pid year
save lapop06.dta, replace

* 10

use lapop_10_raw.dta
recode vb11s (2=-1) (3 4 .=0), gen(pid)
keep  jc15a jc16a jc1 jc10 jc13 pid year
save lapop10.dta, replace

* 12


use lapop_12_raw.dta
recode vb11s (2=-1) (3 4 .=0), gen(pid)
keep  jc15a jc16a jc1 jc10 jc13 pid year
save lapop12.dta, replace


*** Append

use  lapop06.dta , clear
append using  lapop10.dta
append using  lapop12.dta
append using  lapop14.dta
append using  lapop17.dta
append using  lapop19.dta


gen dissolve=.
replace dissolve=100 if jc15a==1
replace dissolve=0 if jc15a==2
gen republican_president=0
replace republican_president=1 if year==2006 | year==2017 | year==2019
gen democrat_president=1-republ
cd "/Users/gaborsimonovits/Dropbox/populism/jop/final_replication_material"

save lapop.dta, replace
